<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'add.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript" src="resources/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
		function checkTitle(){
			var jrName = $("[name=jrname]").val();
			var url="<%=basePath%>JrInfoController/checkInfo";
		$.ajax({
			url : url,
			type : 'post',
			data : {
				'jrName' : jrName
			},
			dataType : 'json',
			success : function(data) {
				if (data> 0) {
					alert("节日已经存在！");
				} else {
				}
			},
			error : function(data) {
				console.log(JSON.stringify(data));
			}
		});
	}
</script>
</head>

<body>
	<form action="<%=basePath%>JrInfoController/addJrInfo" method="post"
		enctype="multipart/form-data">
		节日类型<select name="jrtype">
			<option value="">---请选择----</option>
			<option value="0">中国传统节日</option>
			<option value="1">网络节日</option>
			<option value="2">国际节日</option>
			<option value="3">历史上的今天</option>
		</select> <br /> 节日名称:<input type="text" name="jrname" onblur="javascript:checkTitle()" /><br /> 
		时间: <select name="yue">
			<%
				for (int i = 1; i < 13; i++) {
					if (i < 10) {
					%><option value="0<%=i%>">0<%=i%></option>
					<%
						} else {
					%><option value="<%=i%>"><%=i%></option>
					<%
						}
						}
					%> }
		</select> - <select name="ri">
			<%
				for (int i = 1; i < 31; i++) {
					if (i < 10) {
			%><option value="0<%=i%>">0<%=i%></option>
			<%
				} else {
			%><option value="<%=i%>"><%=i%></option>
			<%
				}
				}
			%> }
		</select> <br /> 
		简介:<textarea id="t1" name="jrxq" rows="3" cols="30"></textarea><br />
<input type="submit" />
	</form>
</body>
</html>
